package com.teach;

public class Demo04 {

	public static void main(String[] args) {
		Thread t1 = new Thread(()->{
			while(true) {
				System.out.println(Thread.currentThread().getName());
				try {
					Thread.sleep(500);
				}catch (Exception e) {
				}
			}
		});
//		t1.setPriority(5);//设置优先级
//		Thread.MIN_PRIORITY=1
//		Thread.MAX_PRIORITY=10
//		Thread.NORM_PRIORITY=5:默认,和父线程保持一致
		t1.setDaemon(true);//true:守护线程,false:默认,用户线程
		t1.start();
		
		for(int i=0;i<10;i++) {
			System.out.println(Thread.currentThread().getName());
			try {
				Thread.sleep(1000);
			}catch (Exception e) {
			}
		}
		
		
	}
}
